home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / MAVM2M (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.7 KB  |  35 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.JList;
  4. import java.awt.event.MouseAdapter;
  5. import java.awt.event.MouseEvent;
  6. import java.io.File;
  7.  
  8. class BasicFileChooserUI$DoubleClickListener extends MouseAdapter {
  9.    // $FF: synthetic field
  10.    BasicFileChooserUI this$0;
  11.    JList list;
  12.  
  13.    // $FF: synthetic method
  14.    public BasicFileChooserUI$DoubleClickListener(BasicFileChooserUI this$0, JList list) {
  15.       this.this$0 = this$0;
  16.       this.list = list;
  17.    }
  18.  
  19.    public void mouseClicked(MouseEvent e) {
  20.       if (e.getClickCount() == 2) {
  21.          int index = this.list.locationToIndex(e.getPoint());
  22.          if (index >= 0) {
  23.             File f = (File)this.list.getModel().getElementAt(index);
  24.             if (this.this$0.getFileChooser().isTraversable(f)) {
  25.                this.list.clearSelection();
  26.                this.this$0.getFileChooser().setCurrentDirectory(f);
  27.             } else {
  28.                this.this$0.getFileChooser().approveSelection();
  29.             }
  30.          }
  31.       }
  32.  
  33.    }
  34. }
  35.